/*
 $Id$

 Copyright (C) 2006-2007 by David Cotton

 This program is free software; you can redistribute it and/or modify it under
 the terms of the GNU General Public License as published by the Free Software
 Foundation; either version 2 of the License, or (at your option) any later
 version.

 This program is distributed in the hope that it will be useful, but WITHOUT
 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

 You should have received a copy of the GNU General Public License along with
 this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
 Street, Fifth Floor, Boston, MA 02110-1301, USA.
 */
package fr.free.jchecs.core.board;

import java.io.Serializable;

import fr.free.jchecs.core.Piece;
import fr.free.jchecs.core.Square;

/**
 * Interface that is provided by classes describing an instantaneous state of
 * the game.
 * <p>
 * Instances of descriptions must be immutable. Comparisons and the calculation
 * of hash keys are assumed compatible between different implementations.
 * </p>
 * 
 * @author David Cotton
 */
public interface Board extends Comparable<Board>, Serializable {
	/**
	 * Reference the law to castle king side (castling) for a color.
	 * 
	 * @param pBlanc
	 *            Set to "true " to get the status of whites.
	 * @return State of the right to castle king side for color.
	 */
	boolean canCastleLong(final boolean pBlanc);

	/**
	 * Reference the law to castle queen side (castling) for a color.
	 * 
	 * @param pBlanc
	 *            Set to "true " to get the status of whites.
	 * @return State of the right to castle queen side for color.
	 */
	boolean canCastleShort(final boolean pBlanc);

	/**
	 * Reference the possible target of the box taken "en passant " in progress.
	 * 
	 * @return Case price target of "passing" (may be null).
	 */
	Square getEnPassant();

	/**
	 * Reference number of the shot.
	 * 
	 * @return Number of stroke (> 0).
	 */
	int getFullmoveNumber();

	/**
	 * Reference counter value of half moves since the last dose or last
	 * movement of a pawn.
	 * 
	 * @return Number of half-strokes (> = 0).
	 */
	int getHalfmoveCount();

	/**
	 * Reference to any room in this box set.
	 * 
	 * @param square
	 *            Box test.
	 * @return This piece on the box (or null if none).
	 */
	Piece getPieceAt(final Square square);

	/**
	 * Reference to any room in this box whose coordinates are indicated.
	 * 
	 * @param column
	 *            Column in the box to test (0 to 7).
	 * @param line
	 *            Line of the box tested (0 to 7).
	 * @return This piece on the box (or null).
	 */
	Piece getPieceAt(final int column, final int line);

	/**
	 * Indicates whether the line is for whites.
	 * 
	 * @return "true" if the feature is to whites, "false"if it is to blacks.
	 */
	boolean isWhiteActive();
}
